package com.masterlu.leetcode.daily.stack.simple;

import java.util.ArrayList;
import java.util.List;

/**
 * 用队列实现栈
 * https://leetcode-cn.com/problems/implement-stack-using-queues/
 *
 * @Author：masterlu
 * @Date：2021/4/25 9:35 上午
 */
public class S225MyStack {

    private List<Integer> list = null;

    public S225MyStack() {
        list = new ArrayList<Integer>();
    }

    public void push(int x) {
        list.add(x);
    }

    public int pop() {
        return list.remove(list.size() - 1);
    }

    public int top() {
        return list.get(list.size() - 1);
    }

    public boolean empty() {
        return list.isEmpty();
    }

}
